<template>
  <div>
    <div>{{ username }} --- {{ age }} --- {{ phone }}</div>
    <div>{{ getUsername }}</div>
    <div>{{ getUser }}</div>
    <div>
      <button @click="changeState1">直接通过store修改state</button>
    </div>
    <div>
      <button @click="changeState2">通过$patch方法来修改state</button>
    </div>
    <div>
      <button @click="changeStateByActions">通过actions中的方法改变state</button>
    </div>
  </div>
</template>

<script setup lang="ts">
import service from './service'
const { username, age, phone, getUsername, getUser } = service.getStore()
const {changeState1, changeState2, changeStateByActions} = service

</script>

<style lang="scss" scoped></style>
